# coding=utf-8
import re


class StripHtmlProcessor(object):
    def __init__(self, txt='123'):
        self.txt = txt
        print 'a'

    def processing(self, item):
        item['title'] = strip_html_tag(item['title'])
        return item

    # @staticmethod
    # def strip_html_tag(text):
    #     dr = re.compile(r'<[^>]+>', re.S)
    #     dd = dr.sub(' ', text)
    #     return dd


def replace_newline(text, original='<br>', new='\r\n'):
        dd = text.replace(original, new)
        return dd


def strip_html_tag(text):
    dr = re.compile(r'<[^>]+>', re.S)
    dd = dr.sub(' ', text)
    return dd


if __name__ == "__main__":
    r = strip_html_tag("<h1>abcdefg</h1>")
    print r
    r = replace_newline('</br>a</br>b</br>', original='</br>')
    print  r